<?php
namespace DesignPatterns\Structural\Decorator\Tests;

use PHPUnit\Framework\TestCase;
use DesignPatterns\Structural\Decorator;
use DesignPatterns\Structural\Decorator\Webservice;

class DecoratorTest extends TestCase {
    private $service;

    protected function setUp() {
        $this->service = new Webservice('foobar');
    }

    public function testJsonDecorator() {
        $service = new Decorator\JsonRenderer($this->service);

        $this->assertEquals('"foobar"', $service->renderData());
    }

    public function testXmlDecorator() {
        $service = new Decorator\XmlRenderer($this->service);

        $this->assertXmlStringEqualsXmlString('<?xml version="1.0"?><content>foobar</content>', $service->renderData());
    }
}
